package 代码记录.Bit48天集训;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Scanner;

/**
 * 1.美国节日(已搞定)
 * 2.分解因数(已搞定)
 * @author zx
 * @create 2022-05-29 19:52
 */
public class day_31 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int year = sc.nextInt();
            int count = 1;
            while(count <= 8){
                if(count == 1){
                    System.out.println(year + "-01-01");
                    count++;
                }else if(count == 2){
                    int day = day_of_demand(year,0,3,2);
                    System.out.println(year + "-01" + "-" + day);
                    count++;
                }else if(count == 3){
                    int day = day_of_demand(year,1,3,2);
                    System.out.println(year + "-02" + "-" + day);
                    count++;
                }else if(count == 4){
                    int day = day(year);
                    System.out.println(year + "-05" + "-" + day);
                    count++;
                }else if(count == 5){
                    System.out.println(year + "-07-04");
                    count++;
                }else if(count == 6){
                    int day = day_of_demand(year,8,1,2);
                    System.out.println(year + "-09" + "-0" + day);
                    count++;
                }else if(count == 7){
                    int day = day_of_demand(year,10,4,5);
                    System.out.println(year + "-11" + "-" + day);
                    count++;
                }else if(count == 8){
                    System.out.println(year + "-12-25");
                    count++;
                }
            }
            System.out.println();
        }
    }
    // 给定年月和第几周的星期几,求出是该月的第几号
    private static int day_of_demand(int year, int month, int count, int d_of_week){
        Calendar c = Calendar.getInstance();
        c.set(Calendar.YEAR,year);
        c.set(Calendar.MONTH, month);
        c.set(Calendar.DAY_OF_MONTH, 1);
        int res = 0;
        for(;;){
            if(c.get(Calendar.DAY_OF_WEEK) == d_of_week){
                count--;
                if(count == 0){
                    res = c.get(Calendar.DAY_OF_MONTH);
                    break;
                }
            }
            c.add(Calendar.DATE, 1);//天数自增1
        }
        return res;
    }
    // 根据某年5月,返回最后一个星期一是几号
    private static int day(int year){
        Calendar c = Calendar.getInstance();
        c.set(Calendar.YEAR, year);
        c.set(Calendar.MONTH, 4);
        int res = 0;
        for(int i = 31;i >= 1;i--){
            c.set(Calendar.DAY_OF_MONTH,i);
            if(c.get(Calendar.DAY_OF_WEEK) == 2){
                res = i;
                break;
            }
        }
        return res;
    }

    public static void main2(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int n = sc.nextInt();
            System.out.print(n + " = ");
            List<Integer> list = new ArrayList<>();
            for(int i = 2;i <= n;i++){
                while(n % i == 0){
                    n = n / i;
                    list.add(i);
                }
            }
            for(int i = 0;i < list.size();i++){
                if(i != list.size() - 1){
                    System.out.print(list.get(i) + " * ");
                }else{
                    System.out.print(list.get(i));
                }
            }
            System.out.println();
        }
    }
}
